Skip to content

Make bare URLs clickable in plain-text messages - #154

Merged
viktorstrate merged 1 commit into
viktorstrate:mainfrom
bmikaili:pr/linkify-bare-urls
Dec 3, 2026
Merged

viktorstrate merged 1 commit into
viktorstrate:mainfrom
bmikaili:pr/linkify-bare-urls

Conversation

@bmikaili

@bmikaili bmikaili commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Bare URLs in plain-text Matrix messages (such as https://example.org/docs or www.example.com) currently render as unclickable text in MessageTextContentView.

  • Adds LinkDetector.linkifyingBareURLs(in:) in Sources/MessageFormatting/LinkDetector.swift. It uses NSDataDetector limited to http, https, and mailto schemes.
  • Preserves existing .link attributes so formatted HTML links and user mentions keep their original targets.
  • Calls LinkDetector.linkifyingBareURLs(in:) in MessageTextContentView.setText(_:matrixClient:) before MentionText.replacingUserLinks.

Testing

  • Added LinkDetectorTests in Tests/MessageFormattingTests/LinkDetectorTests.swift covering bare URLs, plain text without links, and keeping existing link targets.
  • Ran xcodebuild test -workspace Mactrix.xcworkspace -scheme Mactrix -destination 'platform=macOS' on pr/linkify-bare-urls (3fd0bba over 83b77ad). 264 tests passed across 28 suites (TEST SUCCEEDED).

Out of scope

  • Does not change rich-HTML formatting, mention replacement, or link preview cards.

@viktorstrate
viktorstrate merged commit d9256dc into viktorstrate:main Dec 3, 2026
3 checks passed
@viktorstrate

Copy link
Copy Markdown
Owner

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants